package com.suray.wcs.service.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.suray.basic.wcs.plc.entity.PlcLogDB;
import com.suray.wcs.service.system.entity.RgvLogDB;
import com.suray.wcs.service.system.mapper.RgvLogMapper;
import com.suray.wcs.service.system.service.RgvLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Service
public class RgvLogServiceImpl extends ServiceImpl<RgvLogMapper, RgvLogDB> implements RgvLogService {

    @Autowired
    private RgvLogMapper rgvLogMapper;

    @Override
    public List<RgvLogDB> getRgvLogs(RgvLogDB rgvLogDB) {
        return rgvLogMapper.getRgvLogs(rgvLogDB);
    }

    @Override
    public Boolean setInterfaceLog(RgvLogDB rgvLogDB) {
        return this.save(rgvLogDB);
    }

    @Override
    public void deleteThreeDaysAgoLog(Integer days) {
        rgvLogMapper.deleteThreeDaysAgoLog(days, new Date());
    }

    @Override
    public int deleteRgvLogByIds(Long[] rgvLogIds) {
        return rgvLogMapper.deleteBatchIds(Arrays.asList(rgvLogIds));
    }

    @Override
    public void cleanRgvLog() {
        rgvLogMapper.cleanRgvLog();
    }
}
